#include<stdio.h>
int main(){
    int n = 1, input, sum;
    while(1){
        sum = 0;
        scanf("%d",&n);
        if(!n)
            break;
        while(n--){
            scanf("%d",&input);
            sum += input;
        }
        printf("%d\n",sum);
    }
    
   return 0;
}